<template>
  <div class="creatTable">
    <el-table :span-method="objectSpanMethod" :header-cell-style="{ background: '#F3F8FE' }" class="tableHeight"
      :data="ListArr" row-key="id" default-expand-all border lazy :load="load"
       style="width: 90%">
      <el-table-column :label="title" min-width="140">
        <template slot-scope="scope">
          {{ scope.row.name ? scope.row.name : scope.row.bname }}
          <span @click="adminGlAdd(scope.row)" style="color: rgba(51, 119, 255, 1);cursor: pointer"
            v-if="scope.row.bname == '我添加的专利'">新增</span>
          <span @click="adminGl(scope.row)" style="color: rgba(51, 119, 255, 1);cursor: pointer"
            v-if="scope.row.bname == '我添加的专利'">管理</span>
          <span @click="NotGlAdd(scope.row)" style="color: rgba(51, 119, 255, 1);cursor: pointer"
            v-if="scope.row.bname == '申请中专利'">新增</span>
          <span @click="NotGl(scope.row)" style="color: rgba(51, 119, 255, 1);cursor: pointer"
            v-if="scope.row.bname == '申请中专利'">管理</span>
        </template>
      </el-table-column>
      <el-table-column v-if="title == '发明人'" label="院校" min-width="140">
        <template slot-scope="scope">
          <!-- {{scope.row.bname}} -->
          <p v-for="item in scope.row.bname">{{ item }}</p>
        </template>
      </el-table-column>
      <el-table-column prop="" label="专利数量" align="center">
        <template slot-scope="scope">
          <span @click.stop="num(scope.row)">{{
          scope.row.is_data == 1 ? scope.row.patent_num : "数据初始化中"
          }}
            <!-- {{scope.row.id}}   -->
          </span>
          <span class="diff" @click="num_diff(scope.row, scope.column)" v-if="scope.row.is_data == 1">{{
          scope.row.patent_num_diff > 0
          ? `+${scope.row.patent_num_diff}`
          : scope.row.patent_num_diff
          }}
            <!-- {{scope.row.id}}     -->
          </span>
        </template>
      </el-table-column>
      <el-table-column align="center" label="专利类型">
        <el-table-column align="center" label="发明">
          <template slot-scope="scope">
            <span @click="invention(scope.row, scope.column)" v-if="scope.row.is_data == 1">{{ scope.row.invention_num
            }}</span>
            <span class="diff" @click="invention_diff(scope.row, scope.column)" v-if="scope.row.is_data == 1">{{
            scope.row.invention_num_diff > 0
            ? `+${scope.row.invention_num_diff}`
            : scope.row.invention_num_diff
            }}</span>
          </template>
        </el-table-column>
        <el-table-column prop="city" align="center" label="新型">
          <template slot-scope="scope">
            <span @click="invention(scope.row, scope.column)" v-if="scope.row.is_data == 1">
              {{ scope.row.new_num }}</span>
            <span class="diff" @click="invention_diff(scope.row, scope.column)" v-if="scope.row.is_data == 1">{{
            scope.row.new_num_diff > 0
            ? `+${scope.row.new_num_diff}`
            : scope.row.new_num_diff
            }}</span>
          </template>
        </el-table-column>
        <el-table-column align="center" label="外观">
          <template slot-scope="scope">
            <span @click="invention(scope.row, scope.column)" v-if="scope.row.is_data == 1">{{ scope.row.app_num
            }}</span>
            <span class="diff" @click="invention_diff(scope.row, scope.column)" v-if="scope.row.is_data == 1">{{
            scope.row.app_num_diff > 0
            ? `+${scope.row.app_num_diff}`
            : scope.row.app_num_diff
            }}</span>
          </template>
        </el-table-column>
      </el-table-column>
      <el-table-column align="center" label="法律状态">
        <el-table-column align="center" label="授权">
          <template slot-scope="scope">
            <span @click="authClick(scope.row, scope.column)" v-if="scope.row.is_data == 1">
              {{ scope.row.auth_num }}
            </span>
            <span @click="authDiffClick(scope.row, scope.column)" class="diff" v-if="scope.row.is_data == 1">{{
            scope.row.auth_num_diff > 0
            ? `+${scope.row.auth_num_diff}`
            : scope.row.auth_num_diff
            }}</span>
          </template>
        </el-table-column>
        <el-table-column label="审核" align="center">
          <template slot-scope="scope">
            <span @click="authClick(scope.row, scope.column)" v-if="scope.row.is_data == 1">
              {{ scope.row.exam_num }}
            </span>
            <span @click="authDiffClick(scope.row, scope.column)" class="diff" v-if="scope.row.is_data == 1">{{
            scope.row.exam_num_diff > 0
            ? `+${scope.row.exam_num_diff}`
            : scope.row.exam_num_diff
            }}</span>
          </template>
        </el-table-column>
        <el-table-column label="失效" align="center">
          <template slot-scope="scope">
            <span @click="authClick(scope.row, scope.column)" v-if="scope.row.is_data == 1">
              {{ scope.row.invalid_num }}
            </span>
            <span @click="authDiffClick(scope.row, scope.column)" class="diff" v-if="scope.row.is_data == 1">{{
            scope.row.invalid_num_diff > 0
            ? `+${scope.row.invalid_num_diff}`
            : scope.row.invalid_num_diff
            }}</span>
          </template>
        </el-table-column>
      </el-table-column>
      <el-table-column align="center" label="操作">
        <template slot-scope="scope">
          <el-button v-if="handelType == 1" class="see" @click="see(scope.row.id)" type="text">查看
          </el-button>
          <el-button v-if="handelType == 2" class="see" @click="seepat(scope.row.id)" type="text">查看
          </el-button>
          <el-button v-if="handelType == 3" class="see" @click="seecut(scope.row)" type="text">查看
          </el-button>
          <div v-if="is_admin_view == 0">
            <el-button v-if="!scope.row.hasChildren && handelType == 1" class="deletText"
              @click="deletUser(scope.row.id)" type="text">不再关注
            </el-button>
            <el-button v-if="!scope.row.hasChildren && handelType == 3" class="deletText"
              @click="deletUsers(scope.row.id)" type="text">不再关注
            </el-button>
          </div>
        </template>
      </el-table-column>
    </el-table>

    <!--    管理专利-->
    <el-dialog class="gl_dialog" title="管理我的专利" :before-close="closeDialog" :visible.sync="adminpatent" width="80%">
      <el-table border :header-cell-style="{ backgroundColor: '#f5f6f9' }" :data="gridData">
        <div slot="empty" style="cursor: pointer;" @click="CreatCancle = true">您尚未添加专利,<span
            style="cursor: pointer;color:rgb(51, 119, 255)">马上添加</span></div>
        <el-table-column property="ano" label="申请号" width="160"></el-table-column>
        <el-table-column property="tic" label="专利标题"></el-table-column>
        <el-table-column align="center" label="法律状态/事件" width="120">
          <template slot-scope="scope">
            <el-tag style="border: none" size="small" effect="dark" color="#4ba22f" v-if="scope.row.status == '授权'">{{
            scope.row.status
            }}
            </el-tag>
            <el-tag style="border: none" size="small" effect="dark" color="#4ba22f" v-if="scope.row.status == '部分无效'">{{
            scope.row.status
            }}
            </el-tag>
            <el-tag style="border: none" size="small" effect="dark" color="#4ba22f" v-if="scope.row.status == '权利恢复'">{{
            scope.row.status
            }}
            </el-tag>
            <el-tag style="border: none" size="small" effect="dark" color="#6c778b" v-if="scope.row.status == '未缴年费'">{{
            scope.row.status
            }}
            </el-tag>
            <el-tag style="border: none" size="small" effect="dark" color="#6c778b" v-if="scope.row.status == '撤回'">{{
            scope.row.status
            }}
            </el-tag>
            <el-tag style="border: none" size="small" effect="dark" color="#6c778b" v-if="scope.row.status == '驳回'">{{
            scope.row.status
            }}
            </el-tag>
            <el-tag style="border: none" size="small" effect="dark" color="#6c778b" v-if="scope.row.status == '期限届满'">{{
            scope.row.status
            }}
            </el-tag>
            <el-tag style="border: none" size="small" effect="dark" color="#6c778b" v-if="scope.row.status == '避重授权'">{{
            scope.row.status
            }}
            </el-tag>
            <el-tag style="border: none" size="small" effect="dark" color="#6c778b" v-if="scope.row.status == '全部撤销'">{{
            scope.row.status
            }}
            </el-tag>
            <el-tag style="border: none" size="small" effect="dark" color="#da7b21" v-if="scope.row.status == '实质审查'">{{
            scope.row.status
            }}
            </el-tag>
            <el-tag style="border: none" size="small" effect="dark" color="#da7b21" v-if="scope.row.status == '公开'">{{
            scope.row.status
            }}
            </el-tag>
            <!-- <el-tag size="small" v-if="scope.row.event" effect="plain" type="">{{scope.row.event}}</el-tag> -->
            <el-tag style="
                height: 25px;
                line-height: 25px;
                margin-right: 5px;
                margin-bottom: 5px;
              " size="small" v-for="(t, s) in scope.row.event" :key="s" v-if="scope.row.event.length > 0"
              effect="plain" type>{{ t }}
            </el-tag>
          </template>
        </el-table-column>
        <el-table-column prop="apc" align="center" label="当前申请(专利权)人"></el-table-column>
        <el-table-column prop="inc" align="center" label="发明人"></el-table-column>
        <el-table-column prop="ad" align="center" label="申请日"></el-table-column>
        <el-table-column prop="pd" align="center" label="公告(公开)日"></el-table-column>
        <el-table-column property="address" label="操作" width="100">
          <template slot-scope="scope">
            <el-button class="see_del" @click="delpatent(scope.row)" type="text">删除
            </el-button>
          </template>
        </el-table-column>
      </el-table>

      <div class="pagination">
        <el-pagination background style="text-align: left; margin-left: 65px" @size-change="handleSizeChange"
          @current-change="handleCurrentChange" :current-page="page.page" :page-size="page.page_row"
          layout="total, prev, pager, next, jumper" :total="parseInt(page.count)" align="left"></el-pagination>
      </div>
    </el-dialog>

    <!--    添加专利-->
    <el-dialog :destroy-on-close="true" @close="Canle('form')" :close-on-click-modal='false' title="添加专利"
      :visible.sync="CreatCancle" width="40%" center>
      <el-form ref="form" :model="form" label-width="100px" label-position="left">
        <el-form-item prop="name" :error="form[index].message" :label="'专利申请号' + (index + 1)"
          v-for="(item, index) in FormArr" :key="index">
          <el-input type="name" @input="changeInput(index)" style="width:80%;" placeholder="请输入专利申请号"
            v-model="form[index].name"></el-input>
          <el-button type="primary" v-if="(FormArr - 1) == index" @click="addItem(index)">继续添加</el-button>
          <el-button type="danger" v-else @click="deleteItem(index)">删除</el-button>
          <!-- primary danger-->
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button type="button" class="pubBtn2" @click="Canle('form')">取消操作</el-button>
        <el-button type="button" class="pubBtn" @click="CreatSave('form')">确定添加</el-button>
      </span>
    </el-dialog>


    <!-- 申请中的专利 -->
    <el-dialog title="管理我申请中的专利" :visible.sync="NotDataDialog" width="65%" center :before-close="closeDialog">
      <el-table :data="NotGlList" style="width: 100%" @row-click="NotClick">
        <el-table-column prop="sno" label="专利申请号">
        </el-table-column>
        <el-table-column prop="tic" label="专利名称">
        </el-table-column>
        <el-table-column prop="apc" label="申请人">
        </el-table-column>
        <el-table-column prop="aspo" label="发明人">
        </el-table-column>
        <el-table-column prop="ad" label="申请时间">
        </el-table-column>
        <el-table-column prop="type" label="专利类型">
          <template slot-scope="scope">
            {{scope.row.type == 1 ? '发明专利' : scope.row.type == 2 ? '实用新型' : '外观设计'}}
          </template>
        </el-table-column>
        <el-table-column property="address" label="操作" width="100">
          <template slot-scope="scope">
            <span class="see_set" @click.stop="NotSet(scope.row)" type="text">修改
            </span>
          </template>
        </el-table-column>
      </el-table>

      <div class="pagination">
        <el-pagination background style="text-align: left; margin-left: 65px" @current-change="NotChange"
          :current-page="NotPage" :page-size="NotLimit" layout="total, prev, pager, next, jumper" :total="Notcount"
          align="left"></el-pagination>
      </div>
    </el-dialog>

    <!-- 修改申请中专利 -->
    <el-dialog :title="!NotClickTypt ? '修改申请中专利' :'查看申请中专利'" :visible.sync="NotAddDialog" width="40%" center
      :before-close="setNotlist">
      <el-form ref="form" :model="NotAdd" label-width="100px" label-position="left">
        <el-form-item label="专利申请号">
          <el-input v-model="NotAdd.sno" :disabled="NotClickTypt"></el-input>
        </el-form-item>
        <el-form-item label="申请人">
          <el-input v-model="NotAdd.apc" :disabled="NotClickTypt"></el-input>
        </el-form-item>
        <el-form-item label="发明人">
          <el-input v-model="NotAdd.aspo" :disabled="NotClickTypt"></el-input>
        </el-form-item>
        <el-form-item label="专利名称">
          <el-input v-model="NotAdd.tic" :disabled="NotClickTypt"></el-input>
        </el-form-item>
        <el-form-item label="专利申请时间">
          <el-date-picker class="NotPicker" :disabled="NotClickTypt" v-model="NotAdd.ad" type="datetime"
            placeholder="选择日期时间" value-format="yyyy-MM-dd HH:mm:ss">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="专利类型">
          <el-select class="NotSelect" v-model="NotAdd.type" placeholder="请选择" clearable :disabled="NotClickTypt">
            <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item>
          <div style="display: flex;justify-content: flex-end;" v-if="!NotClickTypt">
            <el-button type="button" class="pubBtn2" @click="NotAddDialog = false">取消操作</el-button>
            <el-button type="button" class="pubBtn" @click="onSubmit">确定修改</el-button>
          </div>
        </el-form-item>
      </el-form>
    </el-dialog>
  </div>
</template>

<script>
import { mapGetters, mapState } from "vuex";
import { UserPatentList, DelMyPatent, patentIndex, applyList, applyEdit, patentList } from "@/api";
import { patentDel } from '@/api/adminWeb'
import { insert } from "@/api/user";

export default {
  props: ["ListArr", "handelType", "title", "is_fa"],
  data() {
    return {
      CreatCancle: false,
      pid: Number,
      NotAddDialog: false,
      page: {},
      NotGlList: [],
      NotPage: 1,
      NotAdd: {
        sno: "",
        ad: "",
        apc: "",
        aspo: "",
        tic: "",
        type: '',
        id: ''
      },
      options: [{
        value: 1,
        label: '发明专利'
      },
      {
        value: 2,
        label: '实用新型'
      },
      {
        value: 3,
        label: '外观设计'
      }
      ],
      NotClickTypt: false,
      NotLimit: 10,
      Notcount: 0,
      NotDataDialog: false,
      // childrenList: this.ListArr,
      adminpatent: false,
      expandValue: '',
      value: "6",
      names: "",
      types: null,
      dataArr: [],
      is_inc: 0,
      searchVals: "",
      checkList: [],
      length: null,
      status: 0,
      patentType: 0,
      patentListType: false,
      form: [{
        name: '',
        message: ""
      }],
      FormArr: 1,
      newListArr: [],
      gridData: [
        {}
      ],
    }
  },
  computed: {
    ...mapGetters([
      "sidebar",
      "avatar", 
      "name",
      "roles",
      "type",
      "is_admin_view",
    ]),
    // ...mapState(['seach'])
  },
  created() {
    this.newListArr = this.ListArr
  },
  methods: {
    onSubmit() {
      applyEdit({
        ...this.NotAdd,
        user_id: this.$store.state.user.id,
      }).then(res => {
        this.NotAddDialog = false
        // console.log(res, 'res');
        applyList({
          user_id: this.$store.state.user.id,
          page: this.NotPage,
          limit: this.NotLimit,
        }).then(res => {
          this.NotGlList = res.list
        })
      });
      // console.log(this.NotAdd, 'NotAdd');
    },
    // 添加专利
    Canle(formName) {
      this.CreatCancle = false;
      this.$refs[formName].resetFields();
      this.form = [{
        name: '',
        message: ""
      },
      ]
      this.FormArr = 1
    },
    changeInput(index) {
      this.form[index].message = ''
    },
    addItem(index) {
      if (this.form[index].name == '') {
        this.$message.error("请填写专利申请号")
      } else {
        this.FormArr++;
        this.form.push({
          name: '',
          message: ""
        })
      }
    },
    deleteItem(index) {
      this.FormArr--;
      this.form.splice(index, 1)
    },
    async CreatSave(formName) {
      // const arr = this.form.map(item=>item.name)
      try {
        let time
        const res = await insert({
          ano: this.form,
          ptype: 0
        });
        // console.log(res == "");
        if (res == "") {
          this.$message.success("添加成功")
          this.$refs[formName].resetFields();
          this.form = [{
            name: '',
            message: ""
          },
          ]
          this.FormArr = 1
          // this.getList();
          this.CreatCancle = false;
          let row = {}
          row.id = this.pid
          this.adminGl(row)
          // time = setTimeout(async () => {
          //   const res = await patentIndex({
          //     type: 0
          //   });
          //   this.ListArr = []
          //   this.ListArr.push(res.list_all);
          //   this.page = res.page
          //   this.data = res
          //   clearTimeout(time);
          // }, 1000)
        } else {
          res.data.data.map((item, index) => {
            this.form.map((i, n) => {
              if (index == n && item != true) {
                this.form[n].message = item;
              }
            })
          })
        }
      } catch (e) {
        this.$message.error(e.message)
      }
    },


    //每页下拉显示数据
    async handleSizeChange(size) {
      try {
        const res = await UserPatentList({
          page: size,
          bid: this.names,
          type: this.types,
          order: this.value,
          queryData: this.dataArr,
          is_inc: this.is_inc,
          keywords: this.searchVals,
          data: this.checkList,
          is_core: this.is_core,
          cid: this.expandValue[2],
        });
        this.getPatentList = res.list;
        this.page = res.page;
        this.length = res.page.count;
        document.documentElement.scrollTop = 0;
      } catch (e) {
        this.$message.error(e.message);
      }
    },
    //点击第几页
    async handleCurrentChange(currentPage) {
      // console.log(currentPage)
      try {
        const res = await UserPatentList({
          page: currentPage,
          bid: this.pid,
          type: this.types,
          order: this.value,
          queryData: this.dataArr,
          is_inc: this.is_inc,
          keywords: this.searchVals,
          data: this.checkList,
          is_core: this.is_core,
          cid: this.expandValue[2],
        });
        this.gridData = res.list;
        this.page = res.page;
        this.length = res.page.count;
        document.documentElement.scrollTop = 0;
      } catch (e) {
        this.$message.error(e.message);
      }
    },

    async adminGl(row) {
      let res = await UserPatentList({
        bid: row.id,
        order: '6',
      });
      // console.log(res)
      this.pid = row.id
      this.page = res.page;
      this.adminpatent = true
      this.gridData = res.list
      this.length = res.page.count;

    },
    adminGlAdd() {
      this.$emit('adminGlAdd')
    },
    NotGlAdd() {
      this.$emit('NotGlAdd')
    },
    applyList() {
      applyList({
        user_id: this.$store.state.user.id,
        page: this.NotPage,
        limit: this.NotLimit,
      }).then(res => {
        // console.log(res, 'asddbnk');
        this.NotGlList = res.list
        this.Notcount = res.count
        this.NotDataDialog = true
      })
    },
    NotGl() {
      // this.applyList()
      // console.log(996669);
      this.$router.push({
          path: '/NotpatentDetails',
          query: {
            status: this.status,
            type: this.patentType
          }
        })
    },
    async closeDialog() {
      if (this.adminpatent) {
        this.$emit('getListArr')
      }
      this.adminpatent = false
      this.NotDataDialog = false
      this.NotPage = 1
      this.status = 0
      this.patentType = 0
      // location.reload();
      // let res =  await patentIndex({
      //   type:0
      // })
      // console.log(res.list_all,this.childrenList)
      // this.ListArr = [res.list_all]

    },
    async delpatent(row) {
      this.$confirm('确认删除此专利吗？')
        .then(_ => {
          DelMyPatent({
            user_patent_id: row.id
          });
          UserPatentList({
            bid: row.id,
            order: '6',
          }).then(res => {
            this.pid = row.id
            this.page = res.page;
            this.gridData = res.list
            this.length = res.page.count;
            // console.log(res)
          });

        })
        .catch(_ => {
          this.$message('取消删除');
        });
    },
    async NotSet(data) {
      this.NotAdd.sno = data.sno
      this.NotAdd.apc = data.apc
      this.NotAdd.aspo = data.aspo
      this.NotAdd.tic = data.tic
      this.NotAdd.ad = data.ad
      this.NotAdd.type = data.type
      this.NotAdd.id = data.id
      this.NotAddDialog = true
      // console.log('res131', data)
    },
    setNotlist() {
      this.NotAdd = {
        sno: "",
        ad: "",
        apc: "",
        aspo: "",
        tic: "",
        type: '',
        id: '',
      }
      this.NotAddDialog = false
      this.NotClickTypt = false
    },
    objectSpanMethod({ row, column, rowIndex, columnIndex }) {
      // console.log(column);
      // if (columnIndex == 1) {
      //     return {
      //       rowspan: 2,
      //       colspan: 1
      //     };
      // }
    },
    load(row, treeNode, resolve) {
      // console.log(row, treeNode, resolve, 'row, treeNode, resolve')
      setTimeout(() => {
        resolve(row.children);
      }, 500);
    },
    NotChange(page) {
      // console.log(page)
      this.NotPage = page
      this.patentList()
    },
    patentList() {
      patentList({
        user_id: this.$store.state.user.id,
        status: this.status,
        type: this.patentType,
        page: this.NotPage,
        limit: this.NotLimit,
      }).then(res => {
        // console.log(res, 'asddbnk');
        this.NotGlList = res.list
        this.Notcount = res.count
        this.NotDataDialog = true
      })
    },
    num(row) {
      // console.log(row, 'asdaads')
      if (row.id == 999999999999998) {
        // console.log('申请中的数据啦······全部的');
        //跳转/NotpatentDetails
        this.$router.push({
          path: '/NotpatentDetails',
          query: {
            status: this.status,
            type: this.patentType
          }
        })
        // this.patentList()
      } else if (this.handelType == 2) {
        this.$router.push({
          path: "/patentDetails",
          query: { name: row.id == 1 ? 0 : row.id, type: 0, },
        });
      } else if (this.handelType == 1) {
        this.$router.push({
          path: "/compdetail",
          query: { name: row.id == 1 ? 0 : row.id, type: 1, },
        });
      } else if (this.handelType == 3) {
        if (this.is_fa) {
          this.$router.push({
            path: "/cutDetails",
            query: { name: row.id == 1 ? 0 : row.id, type: 2, fmname: row.name, bnameIds: row.bnameIds },
          });
        } else {
          this.$router.push({
            path: "/cutDetails",
            query: { name: row.id == 1 ? 0 : row.id, type: 2, },
          });
        }
      }
    },
    num_diff(row) {
      // console.log(row)
      if (row.id == 999999999999998) {
        // console.log('申请中的数据啦······更新的');
        this.status = 1
        this.$router.push({
          path: '/NotpatentDetails',
          query: {
            status: this.status,
            type: this.patentType
          }
        })
        // this.patentList()
      } else if (this.handelType == 2) {
        this.$router.push({
          path: "/patentDetails",
          query: { name: row.id == 1 ? 0 : row.id, type: 0, is_inc: 1 },
        });
      } else if (this.handelType == 1) {
        this.$router.push({
          path: "/compdetail",
          query: { name: row.id == 1 ? 0 : row.id, type: 1, is_inc: 1 },
        });
      } else if (this.handelType == 3) {
        if (this.is_fa) {
          this.$router.push({
            path: "/cutDetails",
            query: { name: row.id == 1 ? 0 : row.id, type: 2, is_inc: 1, fmname: row.name, bnameIds: row.bnameIds },
          });
        } else {
          this.$router.push({
            path: "/cutDetails",
            query: { name: row.id == 1 ? 0 : row.id, type: 2, is_inc: 1, },
          });
        }
      }

    },
    invention(row, col) {
      // console.log(this.handelType);
      if (row.id == 999999999999998) {
        // console.log(row, col, '在这类型全部');
        if (col.label == "发明") {
          this.patentType = 1
        } else if (col.label == "新型") {
          this.patentType = 2
        } else if (col.label == "外观") {
          this.patentType = 3
        }
        this.$router.push({
          path: '/NotpatentDetails',
          query: {
            status: this.status,
            type: this.patentType
          }
        })
        // this.patentList()
      } else if (this.handelType == 2) {
        if (col.label == "发明") {
          this.$router.push({
            path: "/patentDetails",
            query: {
              name: row.id == 1 ? 0 : row.id,
              type: 0,
              bs: 2,
              Tname: "发明",
              fmname: row.name,
              bnameIds: row.bnameIds
            },
          });
        } else if (col.label == "新型") {
          this.$router.push({
            path: "/patentDetails",
            query: {
              name: row.id == 1 ? 0 : row.id,
              type: 0,
              bs: 2,
              Tname: "新型",
              fmname: row.name,
              bnameIds: row.bnameIds
            },
          });
        } else if (col.label == "外观") {
          this.$router.push({
            path: "/patentDetails",
            query: {
              name: row.id == 1 ? 0 : row.id,
              type: 0,
              bs: 2,
              Tname: "外观",
              fmname: row.name,
              bnameIds: row.bnameIds
            },
          });
        }
      } else if (this.handelType == 1) {
        if (col.label == "发明") {
          this.$router.push({
            path: "/compdetail",
            query: {
              name: row.id == 1 ? 0 : row.id,
              type: 1,
              bs: 2,
              Tname: "发明",
              fmname: row.name,
              bnameIds: row.bnameIds
            },
          });
        } else if (col.label == "新型") {
          this.$router.push({
            path: "/compdetail",
            query: {
              name: row.id == 1 ? 0 : row.id,
              type: 1,
              bs: 2,
              Tname: "新型",
              fmname: row.name,
              bnameIds: row.bnameIds
            },
          });
        } else if (col.label == "外观") {
          this.$router.push({
            path: "/compdetail",
            query: {
              name: row.id == 1 ? 0 : row.id,
              type: 1,
              bs: 2,
              Tname: "外观",
              fmname: row.name,
              bnameIds: row.bnameIds
            },
          });
        }
      } else if (this.handelType == 3) {
        if (this.is_fa) {
          if (col.label == "发明") {
            this.$router.push({
              path: "/cutDetails",
              query: {
                name: row.id == 1 ? 0 : row.id,
                type: 2,
                bs: 2,
                Tname: "发明",
                fmname: row.name,
                bnameIds: row.bnameIds
              },
            });
          } else if (col.label == "新型") {
            this.$router.push({
              path: "/cutDetails",
              query: {
                name: row.id == 1 ? 0 : row.id,
                type: 2,
                bs: 2,
                Tname: "新型",
                fmname: row.name,
                bnameIds: row.bnameIds
              },
            });
          } else if (col.label == "外观") {
            this.$router.push({
              path: "/cutDetails",
              query: {
                name: row.id == 1 ? 0 : row.id,
                type: 2,
                bs: 2,
                Tname: "外观",
                fmname: row.name,
                bnameIds: row.bnameIds
              },
            });
          }
        } else {
          if (col.label == "发明") {
            this.$router.push({
              path: "/cutDetails",
              query: {
                name: row.id == 1 ? 0 : row.id,
                type: 2,
                bs: 2,
                Tname: "发明",
              },
            });
          } else if (col.label == "新型") {
            this.$router.push({
              path: "/cutDetails",
              query: {
                name: row.id == 1 ? 0 : row.id,
                type: 2,
                bs: 2,
                Tname: "新型",
              },
            });
          } else if (col.label == "外观") {
            this.$router.push({
              path: "/cutDetails",
              query: {
                name: row.id == 1 ? 0 : row.id,
                type: 2,
                bs: 2,
                Tname: "外观",
              },
            });
          }
        }
      }
    },
    invention_diff(row, col) {
      if (row.id == 999999999999998) {
        // console.log(row, col, '在这类型,更新');
        this.status = 1
        if (col.label == "发明") {
          this.patentType = 1
        } else if (col.label == "新型") {
          this.patentType = 2
        } else if (col.label == "外观") {
          this.patentType = 3
        }
        this.$router.push({
          path: '/NotpatentDetails',
          query: {
            status: this.status,
            type: this.patentType
          }
        })
        // this.patentList()
      } else if (this.handelType == 2) {
        if (col.label == "发明") {
          this.$router.push({
            path: "/patentDetails",
            query: {
              name: row.id == 1 ? 0 : row.id,
              type: 0,
              bs: 2,
              Tname: "发明",
              is_inc: 1,
            },
          });
        } else if (col.label == "新型") {
          this.$router.push({
            path: "/patentDetails",
            query: {
              name: row.id == 1 ? 0 : row.id,
              type: 0,
              bs: 2,
              Tname: "新型",
              is_inc: 1,
            },
          });
        } else if (col.label == "外观") {
          this.$router.push({
            path: "/patentDetails",
            query: {
              name: row.id == 1 ? 0 : row.id,
              type: 0,
              bs: 2,
              Tname: "外观",
              is_inc: 1,
            },
          });
        }
      } else if (this.handelType == 1) {
        if (col.label == "发明") {
          this.$router.push({
            path: "/compdetail",
            query: {
              name: row.id == 1 ? 0 : row.id,
              type: 1,
              bs: 2,
              Tname: "发明",
              is_inc: 1,
            },
          });
        } else if (col.label == "新型") {
          this.$router.push({
            path: "/compdetail",
            query: {
              name: row.id == 1 ? 0 : row.id,
              type: 1,
              bs: 2,
              Tname: "新型",
              is_inc: 1,
            },
          });
        } else if (col.label == "外观") {
          this.$router.push({
            path: "/compdetail",
            query: {
              name: row.id == 1 ? 0 : row.id,
              type: 1,
              bs: 2,
              Tname: "外观",
              is_inc: 1,
            },
          });
        }
      } else if (this.handelType == 3) {
        if (this.is_fa) {
          if (col.label == "发明") {
            this.$router.push({
              path: "/cutDetails",
              query: {
                name: row.id == 1 ? 0 : row.id,
                type: 2,
                bs: 2,
                Tname: "发明",
                is_inc: 1,
                fmname: row.name,
                bnameIds: row.bnameIds
              },
            });
          } else if (col.label == "新型") {
            this.$router.push({
              path: "/cutDetails",
              query: {
                name: row.id == 1 ? 0 : row.id,
                type: 2,
                bs: 2,
                Tname: "新型",
                is_inc: 1,
                fmname: row.name,
                bnameIds: row.bnameIds
              },
            });
          } else if (col.label == "外观") {
            this.$router.push({
              path: "/cutDetails",
              query: {
                name: row.id == 1 ? 0 : row.id,
                type: 2,
                bs: 2,
                Tname: "外观",
                is_inc: 1,
                fmname: row.name,
                bnameIds: row.bnameIds
              },
            });
          }
        } else {
          if (col.label == "发明") {
            this.$router.push({
              path: "/cutDetails",
              query: {
                name: row.id == 1 ? 0 : row.id,
                type: 2,
                bs: 2,
                Tname: "发明",
                is_inc: 1,
              },
            });
          } else if (col.label == "新型") {
            this.$router.push({
              path: "/cutDetails",
              query: {
                name: row.id == 1 ? 0 : row.id,
                type: 2,
                bs: 2,
                Tname: "新型",
                is_inc: 1,
              },
            });
          } else if (col.label == "外观") {
            this.$router.push({
              path: "/cutDetails",
              query: {
                name: row.id == 1 ? 0 : row.id,
                type: 2,
                bs: 2,
                Tname: "外观",
                is_inc: 1,
              },
            });
          }
        }

      }
    },

    authClick(row, col) {
      if (row.id == 999999999999998) {
        // console.log(row, col, '在这法律,全部');
        
      } else if (this.handelType == 2) {
        if (col.label == "授权") {
          this.$router.push({
            path: "/patentDetails",
            query: {
              name: row.id == 1 ? 0 : row.id,
              type: 0,
              bs: 4,
              Tname: "授权",
            },
          });
        } else if (col.label == "审核") {
          this.$router.push({
            path: "/patentDetails",
            query: {
              name: row.id == 1 ? 0 : row.id,
              type: 0,
              bs: 4,
              Tname: "审核",
            },
          });
        } else if (col.label == "失效") {
          this.$router.push({
            path: "/patentDetails",
            query: {
              name: row.id == 1 ? 0 : row.id,
              type: 0,
              bs: 4,
              Tname: "失效",
            },
          });
        }
      } else if (this.handelType == 1) {
        if (col.label == "授权") {
          this.$router.push({
            path: "/compdetail",
            query: {
              name: row.id == 1 ? 0 : row.id,
              type: 1,
              bs: 4,
              Tname: "授权",
            },
          });
        } else if (col.label == "审核") {
          this.$router.push({
            path: "/compdetail",
            query: {
              name: row.id == 1 ? 0 : row.id,
              type: 1,
              bs: 4,
              Tname: "审核",
            },
          });
        } else if (col.label == "外观") {
          this.$router.push({
            path: "/compdetail",
            query: {
              name: row.id == 1 ? 0 : row.id,
              type: 1,
              bs: 4,
              Tname: "外观",
            },
          });
        }
      } else if (this.handelType == 3) {
        if (this.is_fa) {
          if (col.label == "授权") {
            this.$router.push({
              path: "/cutDetails",
              query: {
                name: row.id == 1 ? 0 : row.id,
                type: 2,
                bs: 4,
                Tname: "授权",
                fmname: row.name,
                bnameIds: row.bnameIds
              },
            });
          } else if (col.label == "审核") {
            this.$router.push({
              path: "/cutDetails",
              query: {
                name: row.id == 1 ? 0 : row.id,
                type: 2,
                bs: 4,
                Tname: "审核",
                fmname: row.name,
                bnameIds: row.bnameIds
              },
            });
          } else if (col.label == "失效") {
            this.$router.push({
              path: "/cutDetails",
              query: {
                name: row.id == 1 ? 0 : row.id,
                type: 2,
                bs: 4,
                Tname: "失效",
                fmname: row.name,
                bnameIds: row.bnameIds
              },
            });
          }
        } else {
          if (col.label == "授权") {
            this.$router.push({
              path: "/cutDetails",
              query: {
                name: row.id == 1 ? 0 : row.id,
                type: 2,
                bs: 4,
                Tname: "授权",
              },
            });
          } else if (col.label == "审核") {
            this.$router.push({
              path: "/cutDetails",
              query: {
                name: row.id == 1 ? 0 : row.id,
                type: 2,
                bs: 4,
                Tname: "审核",
              },
            });
          } else if (col.label == "失效") {
            this.$router.push({
              path: "/cutDetails",
              query: {
                name: row.id == 1 ? 0 : row.id,
                type: 2,
                bs: 4,
                Tname: "失效",
              },
            });
          }
        }
      }
    },
    authDiffClick(row, col) {
      if (row.id == 999999999999998) {
        // console.log(row, col, '在这法律,更新');
      } else if (this.handelType == 2) {
        if (col.label == "授权") {
          this.$router.push({
            path: "/patentDetails",
            query: {
              name: row.id == 1 ? 0 : row.id,
              type: 0,
              bs: 4,
              Tname: "授权",
              is_inc: 1,
              fmname: row.name,
              bnameIds: row.bnameIds
            },
          });
        } else if (col.label == "审核") {
          this.$router.push({
            path: "/patentDetails",
            query: {
              name: row.id == 1 ? 0 : row.id,
              type: 0,
              bs: 4,
              Tname: "审核",
              is_inc: 1,
              fmname: row.name,
              bnameIds: row.bnameIds
            },
          });
        } else if (col.label == "失效") {
          this.$router.push({
            path: "/patentDetails",
            query: {
              name: row.id == 1 ? 0 : row.id,
              type: 0,
              bs: 4,
              Tname: "失效",
              is_inc: 1,
              fmname: row.name,
              bnameIds: row.bnameIds
            },
          });
        }
      } else if (this.handelType == 1) {
        if (col.label == "授权") {
          this.$router.push({
            path: "/compdetail",
            query: {
              name: row.id == 1 ? 0 : row.id,
              type: 1,
              bs: 4,
              Tname: "授权",
              is_inc: 1,
              fmname: row.name,
              bnameIds: row.bnameIds
            },
          });
        } else if (col.label == "审核") {
          this.$router.push({
            path: "/compdetail",
            query: {
              name: row.id == 1 ? 0 : row.id,
              type: 1,
              bs: 4,
              Tname: "审核",
              is_inc: 1,
              fmname: row.name,
              bnameIds: row.bnameIds
            },
          });
        } else if (col.label == "外观") {
          this.$router.push({
            path: "/compdetail",
            query: {
              name: row.id == 1 ? 0 : row.id,
              type: 1,
              bs: 4,
              Tname: "外观",
              is_inc: 1,
              fmname: row.name,
              bnameIds: row.bnameIds
            },
          });
        }
      } else if (this.handelType == 3) {
        if (this.is_fa) {
          if (col.label == "授权") {
            this.$router.push({
              path: "/cutDetails",
              query: {
                name: row.id == 1 ? 0 : row.id,
                type: 2,
                bs: 4,
                Tname: "授权",
                is_inc: 1,
                fmname: row.name,
                bnameIds: row.bnameIds
              },
            });
          } else if (col.label == "审核") {
            this.$router.push({
              path: "/cutDetails",
              query: {
                name: row.id == 1 ? 0 : row.id,
                type: 2,
                bs: 4,
                Tname: "审核",
                is_inc: 1,
                fmname: row.name,
                bnameIds: row.bnameIds
              },
            });
          } else if (col.label == "失效") {
            this.$router.push({
              path: "/cutDetails",
              query: {
                name: row.id == 1 ? 0 : row.id,
                type: 2,
                bs: 4,
                Tname: "失效",
                is_inc: 1,
                fmname: row.name,
                bnameIds: row.bnameIds
              },
            });
          }
        } else {
          if (col.label == "授权") {
            this.$router.push({
              path: "/cutDetails",
              query: {
                name: row.id == 1 ? 0 : row.id,
                type: 2,
                bs: 4,
                Tname: "授权",
                is_inc: 1,
              },
            });
          } else if (col.label == "审核") {
            this.$router.push({
              path: "/cutDetails",
              query: {
                name: row.id == 1 ? 0 : row.id,
                type: 2,
                bs: 4,
                Tname: "审核",
                is_inc: 1,
              },
            });
          } else if (col.label == "失效") {
            this.$router.push({
              path: "/cutDetails",
              query: {
                name: row.id == 1 ? 0 : row.id,
                type: 2,
                bs: 4,
                Tname: "失效",
                is_inc: 1,
              },
            });
          }
        }
      }
    },

    see(id) {
      if (id != 999999999999998) {
        this.$router.push({ path: "/compdetail", query: { name: id, type: 1 } });
      } else {
        // this.applyList()
        this.$router.push({
          path: '/NotpatentDetails',
          query: {
            status: this.status,
            type: this.patentType
          }
        })
      }
    },
    seepat(id) {
      if (id != 999999999999998) {
        this.$router.push({
          path: "/patentDetails",
          query: { name: id == 1 ? 0 : id, type: 0 },
        });
      } else {
        // this.applyList()
        this.$router.push({
          path: '/NotpatentDetails',
          query: {
            status: this.status,
            type: this.patentType
          }
        })
      }
    },
    seecut(row) {
      if (row.id != 999999999999998) {
        if (this.is_fa) {
          this.$router.push({ path: "/cutDetails", query: { name: row.id, type: 2, fmname: row.name, bnameIds: row.bnameIds } });
        } else {
          this.$router.push({ path: "/cutDetails", query: { name: row.id, type: 2, } });
        }
      } else {
        // this.applyList()
        this.$router.push({
          path: '/NotpatentDetails',
          query: {
            status: this.status,
            type: this.patentType
          }
        })
      }
    },
    deletUser(id) {
      this.$emit("deletUser", id);
    },
    deletUsers(id) {
      this.$emit("deletUsers", id);
    },
    NotClick(row, column, event) {
      // console.log("不可点击", row, column, event);
      this.NotSet(row)
      this.NotClickTypt = true
    },
  },
};
</script>

<style lang="less" scoped>
.diff {
  color: #f05c6c;
}

.pagination {
  margin-top: 20px;
}

.see_del {
  background-color: #ca0010;
  color: #fff;
  padding: 12px 24px;

}

.see_set {
  background-color: #1890ff;
  color: #fff;
  padding: 12px 24px;
  cursor: pointer;
}

::v-deep .gl_dialog {
  .el-dialog__header {
    .el-dialog__title {
      position: absolute;
      left: 50%;
      transform: translate(-50%, 0);
    }

  }
}

::v-deep .has-gutter {
  tr th:nth-child(8) {
    text-align: center;
  }
}
::v-deep .expanded {
  .cell {
    font-weight: bold;
  }
}
</style>
